package com.zyb.beiojbackendjudgeservice.codesandbox;


import com.zyb.beiojmodel.model.codesandbox.ExecuteCodeRequest;
import com.zyb.beiojmodel.model.codesandbox.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @author 十八岁讨厌编程
 * @date 2025/2/10 22:14
 * @PROJECT_NAME beioj-backend
 * @description 使用静态代理对代码沙箱进行增强
 */

@Slf4j
public class CodeSandboxProxy implements CodeSandbox{

    private CodeSandbox codeSandbox;

    public CodeSandboxProxy(CodeSandbox codeSandbox) {
        this.codeSandbox = codeSandbox;
    }

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info(executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(executeCodeRequest);
        log.info(executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
